#ifndef DEMONSTRATEWIDGET_H
#define DEMONSTRATEWIDGET_H
#include <QLineEdit>
#include <QWidget>
#include <QLabel>

#define ROBOT_AXINS_NUM 6

#include "Robot.h"
#include "cJSON.h"
#include <QTableWidgetItem>

namespace Ui {
class DemonstrateWidget;
}

typedef enum{
    moveLine = 0,
    moveJoint,
    moveACC,
}FormMotion ;


typedef struct{
    mat pos;
    FormMotion moType;
    uint8_t speed;
    uint8_t cnt;
    uint8_t acc;
    uint32_t posNum;
} DemoMsg;

class ThreeLable:public QWidget
{
    Q_OBJECT
public:
    explicit ThreeLable(QWidget* parent = nullptr);
    QLabel* labFront;
    QLabel* labBack;
    QLabel* labMid;
    ~ThreeLable()
    {delete labFront;delete labBack;delete labMid;}
};

class DemonstrateWidget : public QWidget
{
    Q_OBJECT

public:
    explicit DemonstrateWidget(QWidget *parent,uint64_t num,mat jPos);
    explicit DemonstrateWidget(QWidget *parent,DemoMsg msg);

    DemoMsg getInfo();
    void setPosName(uint64_t num);
    cJSON* getJsonInfo();
    static bool setJsonInfo(cJSON*,DemoMsg*);
    int getNum();
    mat getPos();

    void setPos(mat pos);
    ~DemonstrateWidget();

signals:
    void windowClicked(DemonstrateWidget* addr);
    void numChanged(DemonstrateWidget* addr,int);
private slots:
    void on_twdJoint_clicked(const QModelIndex &index);
    void on_edtPosNum_editingFinished();

private:
    cJSON* jsonInfo = NULL;
    DemoMsg info;
    Ui::DemonstrateWidget *ui;
};


#endif // DEMONSTRATEWIDGET_H
